#!/usr/bin/python3

import requests
import redis


import apikey
import importlib
import time as tm
import os

importlib.reload(apikey)

# 默认apikeys.txt 
# export FTUN_API_KEY_FILE=/mnt/data/project/linuxproject/ftun-src/web/apikeys.txt
api_keys = apikey.API_Keys()
api_keys.load_pool(fpath=os.getenv("FTUN_API_KEY_FILE"))
url = os.getenv("FTUN_SERVER", "http://127.0.0.1:5001")


data = {
    'token': api_keys.get_item(),
}

url = url + '/token'

try:
    response = requests.post(url, json=data)
    print(response.json()["val"])
except Exception as err:
    print(err)
    pass



